<?php


namespace app\api\controller;

use app\admin\pms\logic\GoodsTagLogic;
use app\api\logic\GoodsSearchLogic;
use app\common\controller\BaseApiController;
use app\model\pms\GoodsBrand;

/**
 * 使用搜索引擎搜索商品
 * Class SearchController
 * @package app\api\controller
 */
class SearchController extends BaseApiController
{
    protected $noNeedLogin = ['*'];

    protected function init()
    {
        parent::init();
    }

    public function page()
    {
        return $this->success((new GoodsSearchLogic)->goodsPage($this->form));
    }

    public function goodsBrandList()
    {
        $where = [
            ['is_show', '=', 1]
        ];
        $data = GoodsBrand::where($where)->limit(20)->select();

        return $this->success($data);
    }

    public function goodsTagList()
    {
        $where = [
//            ['is_show','=',1]
        ];
        $data = (new GoodsTagLogic())->getList($where);

        return $this->success($data);
    }

}